﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MainOP
{
    public partial class FormPLC : Form
    {
        public static TextBox textBox;
        public FormPLC()
        {
            InitializeComponent();
            textBox = this.textBox1;
        }
        static string GetLatestFileNameInfo(string dir, string ext)
        {
            DirectoryInfo d = new DirectoryInfo(dir);
            DateTime temp = new DateTime();
            string FileName = "0";
            //Directory.GetFiles(Application.StartupPath + "\\" + "型号", "*.txt");
            foreach (FileInfo file in d.GetFiles())
            {
                if (file.Extension.ToUpper() == ext.ToUpper())
                {
                    if (file.CreationTime > temp)
                    {
                        temp = file.CreationTime;
                        FileName = file.FullName;
                    }
                }
            }

            return FileName;
        }
    }
}
